import request from '../utils/request';
import {RequestConfig} from '../utils/request/type'
<%
function getParamsType  (params){
    let paramsStr = "";
	queryParams.forEach((item, index) => {
		if (index === 0) {
			paramsStr = "{ ";
		}
		paramsStr += `${item.name}${item.required ? "" : "?"}: ${item.type}; `;
		if (index === queryParams.length - 1) {
			paramsStr += "}";
		}
	});
	return paramsStr;
}

%>

<% if (importType.length>0) { %>
import {
<% for (var i = 0; i < importType.length; i++) { %>
<%= importType[i] %>,
<% } %>
} from '@/types/apiType'
<% } %>

<% for (var i = 0; i < apis.length; i++) { %>
<% Object.keys(apis[i]).forEach(function(key) { %>
/**
* @description <%= apis[i][key].description %>
* @tags <%= apis[i][key].curTag %>
* @summary <%= apis[i][key].summary %>
* @request <%= `${apis[i][key].method}:${apis[i][key].path}` %>
*/
export const <%= key %> = (<%= apis[i][key].requestType? `${apis[i][key].requestType} ,`: ''%> config?:RequestConfig ) =>
request
.<%= `${apis[i][key].method}` %>

< <%= apis[i][key].responseType %>>(`<%= `${apis[i][key].path}` %>`, <%= apis[i][key].requestType ? 'params': '{}' %>, config).then(res=>res?.result)

  <% }); %>
  <% } %>